package cn.hl.hm.constants;

import org.apache.commons.lang3.StringUtils;

/**
 * 支付方式： 1、微信2、支付宝3、银联4、京东5、余额6、现金cash
 * 2016-12-29
 * @author 大和
 *
 */
public enum PayMethod {

	ALIPAY_SDK("2","支付宝SDK"),
	WEIXIN_SDK("1","微信SDK"),
	BALANCE("5","余额"),
	CASH("6","现金"),
	CP_PAY("7","银联电子支付"),
	JD_PAY("4","京东支付"),
	YL_PAY("3","银联支付"),
	
	
	
	ROAD_WX_SCAN_USER("22","微信刷卡支付（扫用户）"),
	ROAD_WX_SCAN_MER("21","微信扫码支付（扫商户）"),
	ROAD_ZFB_SCAN_MER("23","支付宝扫码支付（扫商户）"),
	ROAD_BALANCE("25","余额"),
	ROAD_CASH("26","现金"),
	ROAD_ZFB_SCAN_USER("24","支付宝条码支付（扫用户）"),
	
	ROAD_WX_RECHARGE("30","微信充值"),
	ROAD_ZFB_RECHARGE("31","支付宝充值");

	private String code;
	
	private String name;
	
	PayMethod(String code,String name){
		this.name = name;
		this.code = code;
	}
	
	
	public static PayMethod getPayMethod(String code){
		if (StringUtils.isBlank(code)) {
			return null;
		}
		for (PayMethod pm : values()) {
			if (pm.code.equals(code)) {
				return pm;
			}
		}
		return null;
	}


	public String getCode() {
		return code;
	}


	public String getName() {
		return name;
	}
	
}
